package h0728;

import java.util.Scanner;

/**
  * @description 小明的幸运数
  * @author 不知名帅哥
  * @date 2024/7/28 20:06
  * @version 1.0
*/
public class LuckyNumberOfXiaoMing {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n = sc.nextInt();

        int lNum=sc.nextInt();
        int[] arr = new int[n];
        for (int i = 0; i < n; i++) {
            arr[i]=sc.nextInt();
        }
        int res = getRes(arr, lNum);
        System.out.println(res);
    }

    private static int getRes(int[] arr, int lNum) {
        int ans=0;

        int cur=0;//当前位置
        for (int a : arr) {
            if (a==lNum) {
                if (a>0){
                    cur+=a+1;
                }else if (a<0){
                    cur+=a-1;
                }
            }else {
                cur+=a;
            }
            ans=Math.max(ans,cur);
        }
        return ans;
    }
}
